{% extends "base.html" %}

{% block title %}下达指令 - 协同调度信息系统{% endblock %}

{% block content %}
<div class="row justify-content-center">
    <div class="col-md-8">
        <div class="card">
            <div class="card-header">
                <h4 class="mb-0">
                    <i class="fas fa-plus"></i> 下达新指令
                </h4>
            </div>
            <div class="card-body">
                <form method="POST">
                    {{ form.hidden_tag() }}
                    
                    <div class="row">
                        <div class="col-md-6">
                            <div class="mb-3">
                                {{ form.order_type.label(class="form-label") }}
                                {{ form.order_type(class="form-select") }}
                                {% if form.order_type.errors %}
                                    <div class="text-danger">
                                        {% for error in form.order_type.errors %}
                                            <small>{{ error }}</small>
                                        {% endfor %}
                                    </div>
                                {% endif %}
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="mb-3">
                                {{ form.priority.label(class="form-label") }}
                                {{ form.priority(class="form-select") }}
                                {% if form.priority.errors %}
                                    <div class="text-danger">
                                        {% for error in form.priority.errors %}
                                            <small>{{ error }}</small>
                                        {% endfor %}
                                    </div>
                                {% endif %}
                            </div>
                        </div>
                    </div>

                    <div class="mb-3">
                        {{ form.target.label(class="form-label") }}
                        {{ form.target(class="form-control", placeholder="请输入指令目标") }}
                        {% if form.target.errors %}
                            <div class="text-danger">
                                {% for error in form.target.errors %}
                                    <small>{{ error }}</small>
                                {% endfor %}
                            </div>
                        {% endif %}
                        <div class="form-text">
                            <i class="fas fa-info-circle"></i>
                            明确指定指令的目标对象，如系统名称、IP地址、人员等
                        </div>
                    </div>

                    <div class="mb-3">
                        {{ form.objective.label(class="form-label") }}
                        {{ form.objective(class="form-control", rows="4", placeholder="请描述指令的目标和期望结果...") }}
                        {% if form.objective.errors %}
                            <div class="text-danger">
                                {% for error in form.objective.errors %}
                                    <small>{{ error }}</small>
                                {% endfor %}
                            </div>
                        {% endif %}
                        <div class="form-text">
                            <i class="fas fa-info-circle"></i>
                            详细描述指令的目标和期望达到的结果
                        </div>
                    </div>

                    <div class="mb-3">
                        {{ form.instructions.label(class="form-label") }}
                        {{ form.instructions(class="form-control", rows="6", placeholder="请提供具体的执行指令...") }}
                        {% if form.instructions.errors %}
                            <div class="text-danger">
                                {% for error in form.instructions.errors %}
                                    <small>{{ error }}</small>
                                {% endfor %}
                            </div>
                        {% endif %}
                        <div class="form-text">
                            <i class="fas fa-info-circle"></i>
                            提供详细的执行步骤和具体要求
                        </div>
                    </div>

                    <div class="mb-3">
                        {{ form.assigned_to.label(class="form-label") }}
                        {{ form.assigned_to(class="form-select") }}
                        {% if form.assigned_to.errors %}
                            <div class="text-danger">
                                {% for error in form.assigned_to.errors %}
                                    <small>{{ error }}</small>
                                {% endfor %}
                            </div>
                        {% endif %}
                        <div class="form-text">
                            <i class="fas fa-info-circle"></i>
                            选择负责执行此指令的人员
                        </div>
                    </div>

                    <div class="d-grid gap-2 d-md-flex justify-content-md-end">
                        <a href="{{ url_for('decision_dashboard') }}" class="btn btn-secondary me-md-2">
                            <i class="fas fa-arrow-left"></i> 返回
                        </a>
                        {{ form.submit(class="btn btn-primary") }}
                    </div>
                </form>
            </div>
        </div>

        <!-- 指令类型说明 -->
        <div class="card mt-4">
            <div class="card-header">
                <h6 class="mb-0">
                    <i class="fas fa-info-circle"></i> 指令类型说明
                </h6>
            </div>
            <div class="card-body">
                <div class="row">
                    <div class="col-md-4">
                        <div class="text-center">
                            <i class="fas fa-search fa-2x text-success mb-2"></i>
                            <h6>侦察指令</h6>
                            <small class="text-muted">
                                下达给侦察员，要求进行信息收集和侦察活动
                            </small>
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="text-center">
                            <i class="fas fa-chart-line fa-2x text-info mb-2"></i>
                            <h6>分析指令</h6>
                            <small class="text-muted">
                                下达给分析员，要求对特定数据进行深度分析
                            </small>
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="text-center">
                            <i class="fas fa-cogs fa-2x text-danger mb-2"></i>
                            <h6>执行指令</h6>
                            <small class="text-muted">
                                下达给执行员，要求执行具体的行动方案
                            </small>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!-- 优先级说明 -->
        <div class="card mt-4">
            <div class="card-header">
                <h6 class="mb-0">
                    <i class="fas fa-exclamation-triangle"></i> 优先级说明
                </h6>
            </div>
            <div class="card-body">
                <div class="row">
                    <div class="col-md-3">
                        <div class="text-center">
                            <span class="priority-badge priority-low">低</span>
                            <h6 class="mt-2">低优先级</h6>
                            <small class="text-muted">常规任务，可在空闲时间处理</small>
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="text-center">
                            <span class="priority-badge priority-medium">中</span>
                            <h6 class="mt-2">中优先级</h6>
                            <small class="text-muted">重要任务，需要及时处理</small>
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="text-center">
                            <span class="priority-badge priority-high">高</span>
                            <h6 class="mt-2">高优先级</h6>
                            <small class="text-muted">紧急任务，需要优先处理</small>
                        </div>
                    </div>
                    <div class="col-md-3">
                        <div class="text-center">
                            <span class="priority-badge priority-critical">紧急</span>
                            <h6 class="mt-2">紧急优先级</h6>
                            <small class="text-muted">最高优先级，立即处理</small>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}
